#ifndef _VECTOR_H_
#define _VECTOR_H_

#ifndef real
#define real float
#endif

class Vector2;
class Vector3;

class Vector2
{
public:
	real x,y;

	Vector2(void);
	Vector2(const Vector2 &vector);
	Vector2(real x, real y);	
	Vector2& operator = (Vector2 &v);
	Vector2& operator += (Vector2 &v);
	Vector2& operator -= (Vector2 &v);
	Vector2& operator *= (real value);
	Vector2& operator /= (real value);

	Vector2& Normalize(void);	
	real Length(void);
	real PoweredLength(void);
	static real DotProduct(Vector2 &v1, Vector2 &v2);	

	static void Add(Vector2 &result, Vector2 &v1, Vector2 &v2);
	static void Subtract(Vector2 &result, Vector2 &v1, Vector2 &v2);
	static void Multiply(Vector2 &result, Vector2 &v, real value);
	static void Multiply(Vector2 &result, real value, Vector2 &v);
	static void Divide(Vector2 &result, Vector2 v, real value);
	static Vector2 Normalized(Vector2 &v);
	static void Normalized(Vector2 &result, Vector2 &v);
	static Vector2 Interpolate(Vector2 &v1, Vector2 &v2, real t);
	static void Interpolate(Vector2 &result, Vector2 &v1, Vector2 &v2, real t);
};

class Vector3
{
public:
	real x,y,z;

	Vector3(void);	
	Vector3(const Vector2 &vector);
	Vector3(const Vector3 &vector);
	Vector3(real x, real y, real z);	
	Vector3& operator = (Vector3 &v);
	Vector3& operator += (Vector3 &v);
	Vector3& operator -= (Vector3 &v);
	Vector3& operator *= (real value);
	Vector3& operator /= (real value);

	Vector3& Normalize(void);
	real Length(void);
	real PoweredLength(void);

	static real DotProduct(Vector3 &v1, Vector3 &v2);
	static Vector3 CrossProduct(Vector3 &v1, Vector3 &v2);

	static void Add(Vector3 &result, Vector3 &v1, Vector3 &v2);
	static void Subtract(Vector3 &result, Vector3 &v1, Vector3 &v2);
	static void Multiply(Vector3 &result, Vector3 &v, real value);
	static void Multiply(Vector3 &result, real value, Vector3 &v);
	static void Divide(Vector3 &result, Vector3 v, real value);
	static Vector3 Normalized(Vector3 &v);
	static void Normalized(Vector3 &result, Vector3 &v);
	static Vector3 Interpolate(Vector3 &v1, Vector3 &v2, real t);
	static void Interpolate(Vector3 &result, Vector3 &v1, Vector3 &v2, real t);
};

Vector3 operator + (Vector3 &v1, Vector3 &v2);
Vector3 operator - (Vector3 &v1, Vector3 &v2);
Vector3 operator * (Vector3 &v, real value);
Vector3 operator * (real value, Vector3 &v);
Vector3 operator / (Vector3 &v, real value);

Vector2 operator + (Vector2 &v1, Vector2 &v2);
Vector2 operator - (Vector2 &v1, Vector2 &v2);
Vector2 operator * (Vector2 &v, real value);
Vector2 operator * (real value, Vector2 &v);
Vector2 operator / (Vector2 &v, real value);

#endif